package com.chen.bpsptsystem.controller.manger;

import com.chen.bpsptsystem.common.ServerResponse;
import com.chen.bpsptsystem.utils.Upload;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @CLASSNAME UploadController
 * @DESCRIPTION 描述
 * @AUTHOR chen
 * @DATE 2019-02-17 12:57
 **/

@RequestMapping("/wx/")
@RestController
public class UploadController {

    @PostMapping("upload")
    public ServerResponse upload(@RequestParam("file") MultipartFile file) {
        String path = "d://profile//";
        ServerResponse response = Upload.upload(file, path);
        if (response.isSuccess()) {
            return ServerResponse.createBySuccess(response.getData());
        }
        return response;
    }

}
